﻿using FileManager.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Telerik.Web.Mvc;

namespace FileManager.Areas.Admin.Controllers
{
    public class InstitutionController : Controller
    {
        private FileManagerEntities db = new FileManagerEntities();
        //
        // GET: /Admin/Institution/
        public ActionResult Index()
        {
            return View(db.Institution.ToList());
        }

        [GridAction(EnableCustomBinding = true)]
        public ActionResult _AjaxSelect(GridState state)
        {
            var skip = (state.Page - 1) * state.Size;
            var data = db.Institution.OrderBy(i => i.Id).Skip(skip).Take(state.Size).ToList();
            return View(new GridModel<Institution> { Data = data, Total = db.Institution.Count() });
        }
	}
}